<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    #tab {
      width: 500px;
      margin: 20px auto;
    }

    ul {
      width: 100%;
      display: flex;

      justify-content: space-around;
    }

    li {
      list-style: none;
      width: 100px;
      height: 60px;
      text-align: center;
      line-height: 60px;
      background: pink;
      cursor: pointer;
    }

    ul .active {
      background: red;
      color: white;
    }

    #content {
      width: 100%;
      height: 400px;
    }

    #content>div {
      width: 100%;
      height: 400px;
      display: none;
    }

    #content>div:nth-child(1) {
      background: sandybrown;
      display: block;
    }

    #content>div:nth-child(2) {
      background: darkcyan;
    }

    #content>div:nth-child(3) {
      background: fuchsia;
    }

    #content>div:nth-child(4) {
      background: darkkhaki;
    }
  </style>
</head>

<body>
  <div id="tab">
    <ul>
      <li class="active">首页</li>
      <li>科技</li>
      <li>汽车</li>
      <li>男人</li>
    </ul>
    <div id="content">
      <div>
        首页内容
      </div>
      <div>
        科技内容
      </div>
      <div>
        汽车内容
      </div>
      <div>
        男人内容
      </div>
    </div>
  </div>
  <script src="./tab.js"></script>
  <script>

    var tab = new Tab("tab", {
      width: 800
    })




  </script>
</body>

</html>